package offer;

public class _10_斐波那契数列 {
    public static void main(String[] args) {
        int n = 100;
        Solution solution = new _10_斐波那契数列().new Solution();
        System.out.println(solution.fib(n));
    }

    class Solution {
        public int fib(int n) {
            if(n == 0) return 0;
            if(n == 1) return 1;
            int one = 0;
            int two = 1;
            int i = 0;
            int res;
            while (i < n-1) {
                res = (one + two) % 1000000007;
                one = two;
                two = res;
                i++;
            }
            return two;
        }
    }
}
